<div class="page-header">
	<ul id="table-tab" class="nav nav-tabs" role="tablist">
		<li role="presentation" class="active"><a href="#account-tab"
			aria-controls="account-tab" role="tab" data-toggle="tab">密码修改</a></li>
	</ul>
</div>
<div class="tab-content">
	<div id="account-tab" class="tab-pane active" role="tabpanel">
		<div class="row">
			<div class="col-md-3">
				<form id="account-form" class="form-horizontal" role="form">
					<div class="form-group">
						<label class="col-sm-5 control-label">输入旧密码</label>
						<div class="col-sm-7">
							<input type="password" class="form-control" id="oldPwd" placeholder="输入旧密码">
						</div>
					</div>

					<div class="form-group">
						<label class="col-sm-5 control-label">输入新密码</label>
						<div class="col-sm-7">
							<input type="password" class="form-control" id="newPwd" placeholder="输入新密码">
						</div>
					</div>

					<div class="form-group">
						<label class="col-sm-5 control-label">确认新密码</label>
						<div class="col-sm-7">
							<input type="password" class="form-control" id="confirmPwd" placeholder="确认新密码">
						</div>
					</div>
					
					<div class="rows">
						<div class="profile-user-info" style="margin-top: 1em;">
							<button type="button" class="btn btn-default " id="savebtn" onclick="updPassword('system/ucenter/savePassword', 'account-form')">修改</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>

<script type="text/javascript">
<!--//-->
function updPassword(url, formId){	
	var oldPwd = $('#oldPwd').val();
	var newPwd = $('#newPwd').val();
	var confirmPwd = $('#confirmPwd').val();
	console.log(oldPwd + "|" + newPwd + "|" + confirmPwd);
	if(newPwd != confirmPwd){
		TipMsg.error("2次输入的密码不一致，请重新输入！", 0);
		return;
	}
	$.ajax({
		type : "POST",
		url : url,
		data : "oldPwd=" + oldPwd + "&newPwd=" + newPwd,
		success : function(data) {
			if (data.status == "OK") {
				hideModal();
				TipMsg.success(data.message, 0);
			} else if (data.status == "ERROR") {
				TipMsg.error(data.message, 0);
			} else {
				var errors = data.errors;
				var msg = "";
				for ( var key in errors) {
					msg = errors[key];
				}
				TipMsg.error(msg, 0);
			}
		}
	});
};
</script>